/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 123
 * Date: 2023-05-09
 * Time: 21:47
 */
public class Computer {
    public void opencomputer(){
        System.out.println("打开电脑");
    }

    public void closcomputer(){
        System.out.println("关闭电脑");
    }

    public void useusb(IUsb usb){
        usb.openusb();
       if(usb instanceof Mous){
           Mous mous = (Mous) usb;
           mous.clik();
       } else if (usb instanceof Kborad) {
           Kborad kborad = (Kborad) usb;
           kborad.jp();
       }
        usb.closusb();

    }

    public static void main(String[] args) {
        Computer computer = new Computer();
        Mous mous = new Mous();
        Kborad kborad = new Kborad();
        computer.opencomputer();
        computer.useusb(mous);
        computer.useusb(kborad);
         computer.closcomputer();
    }

}

